<?php
include_once '../includes/common.php';
if($islogin2==1){}else sysmsg("您还未登录，请先登录",2,'./login.php',true);
$typessss = isset($_GET['type'])?intval($_GET['type']):sysmsg('参数不完整');
if($typessss>3)sysmsg('参数不完整');
if($typessss==1){
    $title_name='模板';
}elseif($typessss==2){
    $title_name='插件';
}elseif($typessss==3){
    $title_name='其他';
}
$title=$title_name.'商品列表';
include_once './header.php';
if($conf['Market_open']!=1)showmsg('错误', '授权平台未开放商城系统！', 4, './');
?>
  <link href="../assets/layui/style/admin.css" rel="stylesheet" media="all">
  <link href="../assets/layui/style/template.css" rel="stylesheet" media="all">
  <style>
    .auth_input {
        width: calc(100% - 3em);
        height: 2.4em;
        text-align: left;
        margin-top: 0.4em;
        border: none;
        background-color: whitesmoke;
        text-indent: 1em;
        border-radius: 0.3em 0.0em 0em 0.3em;
    }

    .auth_colas {
        width: 16em;
        height: 3em;
        background-color: white;
        display: flex;
        float: right;
        padding: 0;
        margin: 0;
        border-radius: 0.5em;
        margin-right: 0.5em;
        transition: all 0.3s;
    }

    .auth_colas a {
        width: 3em;
        height: 2.4em;
        background-color: whitesmoke;
        margin-top: 0.4em;
        border-radius: 0.0em 0.3em 0.3em 0.0em;
        cursor: pointer;
    }

    .auth_colas a:hover {
        color: mediumslateblue;
    }

    .fleott a {
        width: auto;
        text-align: center;
        height: 3em;
        line-height: 3em;
        display: flex;
        float: left;
        display: block;
        cursor: pointer;
        transition: all 0.3s;
        padding: 0 1em 0 1em;
    }

    .fleott a:hover {
        color: #f20d0d;
    }

    @media only screen and (min-width: 700px) {
        .auth_colas {
            width: 35em;
        }
    }

    .auth_active {
        background: rgba(242, 13, 13, .06);
        border-radius: 6px;
        font-weight: 700;
        color: #f20d0d;
    }

    .auth_biaot {
        position: absolute;
        top: 0em;
        right: 0em;
        height: 2em;
        display: block;
    }

    .auth_left {
        position: absolute;
        top: 1.35em;
        right: 0em;
        height: 2em;
        display: block;
    }
    .auth_div {
        overflow: hidden;
    }

    @media only screen and (min-width: 700px) {
        .auth_div {
            margin-top: 0.5em;
        }
    }

    .auth_a_image {
        height: 17em !important;
        display: block;
        overflow: hidden;
    }

    .auth_image {
        width: 100%;
        transition: all 0.4s;
    }

    .auth_image:hover {
        -webkit-transform: scale(2) rotate(3deg);
        -moz-transform: scale(2) rotate(3deg);
        -o-transform: scale(2) rotate(3deg);
    }

    .layui-layer-imgbar {
        display: block !important;
    }
    .image_body {
        height: 100px;
        overflow: hidden;
        padding: 0;
        padding-bottom: 1rem;
        text-align: center;
        margin-bottom: 1rem;
    }
    </style>
    <div class="layui-row">
        <div class="layui-col-xs12">
            <div class="layui-card">
                <div class="layui-card-header" style="padding-right:0;">商品筛选
                     <div class="auth_colas"><input type="text" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5\@\.]/g,'')" name="seek" id="seek" title="可填写名称或介绍的关键词!" placeholder="搜索感兴趣的内容" class="auth_input"/><a href="javascript:seek()" title="可填写名称或介绍的关键词"><i class="layui-icon layui-icon-search"></i></a></div></div>
                        <div class="layui-card-body" style="padding: 0;">
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-xs2 layui-col-sm1" style="text-align: right;font-weight: 700;color: black;height: 3em;line-height: 3em;">
                                价格:
                            </div>
                            <div class="layui-col-xs10 layui-col-sm11 fleott">
                                <a href="javascript:listTable('type=<?php echo $typessss?>');">全部</a>
                                <a href="javascript:listTable('type=<?php echo $typessss?>&money=1');">免费商品</a>
                                <a href="javascript:listTable('type=<?php echo $typessss?>&money=2');">人气商品</a>
                                <a href="javascript:listTable('type=<?php echo $typessss?>&money=3');">0-5元</a>
                                <a href="javascript:listTable('type=<?php echo $typessss?>&money=4');">5-15元</a>
                                <a href="javascript:listTable('type=<?php echo $typessss?>&money=5');">15-30元</a>
                                <a href="javascript:listTable('type=<?php echo $typessss?>&money=6');">30-999元</a>
                            </div>
                        </div>
                    </div>
              </div>
        </div>
    </div>
    <div class="layui-row layui-col-space30" id="content">
        <div class="layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg3 auth_div" style="opacity: 0.6;">
            <div class="cmdlist-container">
                <div class="layui-card-header layui-elip" style="text-align: center;font-size: 1.4em;" title=" "></div>
                <a href="javascript:;" class="auth_a_image" style="background-color: whitesmoke;"></a><a
                        href="javascript:;"></a>
                <div class="cmdlist-text">
                    <div class="price layui-text-center"
                         style="padding-top: 0.25em;margin-top: 0.25em;border-top: 1px solid #eee;">
                        <div class="layui-row"><a>
                                <div class="layui-col-xs12">
                                    <button class="layui-btn layui-btn-fluid layui-btn-sm layui-btn-primary"
                                            style="border: none;"></button>
                                </div>
                            </a></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg3 auth_div" style="opacity: 0.6;">
            <div class="cmdlist-container">
                <div class="layui-card-header layui-elip" style="text-align: center;font-size: 1.4em;" title=" "></div>
                <a href="javascript:;" class="auth_a_image" style="background-color: whitesmoke;"></a><a
                        href="javascript:;"></a>
                <div class="cmdlist-text">
                    <div class="price layui-text-center"
                         style="padding-top: 0.25em;margin-top: 0.25em;border-top: 1px solid #eee;">
                        <div class="layui-row"><a>
                                <div class="layui-col-xs12">
                                    <button class="layui-btn layui-btn-fluid layui-btn-sm layui-btn-primary"
                                            style="border: none;"></button>
                                </div>
                            </a></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg3 auth_div" style="opacity: 0.6;">
            <div class="cmdlist-container">
                <div class="layui-card-header layui-elip" style="text-align: center;font-size: 1.4em;" title=" "></div>
                <a href="javascript:;" class="auth_a_image" style="background-color: whitesmoke;"></a><a
                        href="javascript:;"></a>
                <div class="cmdlist-text">
                    <div class="price layui-text-center"
                         style="padding-top: 0.25em;margin-top: 0.25em;border-top: 1px solid #eee;">
                        <div class="layui-row"><a>
                                <div class="layui-col-xs12">
                                    <button class="layui-btn layui-btn-fluid layui-btn-sm layui-btn-primary"
                                            style="border: none;"></button>
                                </div>
                            </a></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg3 auth_div" style="opacity: 0.6;">
            <div class="cmdlist-container">
                <div class="layui-card-header layui-elip" style="text-align: center;font-size: 1.4em;" title=" "></div>
                <a href="javascript:;" class="auth_a_image" style="background-color: whitesmoke;"></a><a
                        href="javascript:;"></a>
                <div class="cmdlist-text">
                    <div class="price layui-text-center"
                         style="padding-top: 0.25em;margin-top: 0.25em;border-top: 1px solid #eee;">
                        <div class="layui-row"><a>
                                <div class="layui-col-xs12">
                                    <button class="layui-btn layui-btn-fluid layui-btn-sm layui-btn-primary"
                                            style="border: none;"></button>
                                </div>
                            </a></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg3 auth_div" style="opacity: 0.6;">
            <div class="cmdlist-container">
                <div class="layui-card-header layui-elip" style="text-align: center;font-size: 1.4em;" title=" "></div>
                <a href="javascript:;" class="auth_a_image" style="background-color: whitesmoke;"></a><a
                        href="javascript:;"></a>
                <div class="cmdlist-text">
                    <div class="price layui-text-center"
                         style="padding-top: 0.25em;margin-top: 0.25em;border-top: 1px solid #eee;">
                        <div class="layui-row"><a>
                                <div class="layui-col-xs12">
                                    <button class="layui-btn layui-btn-fluid layui-btn-sm layui-btn-primary"
                                            style="border: none;"></button>
                                </div>
                            </a></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg3 auth_div" style="opacity: 0.6;">
            <div class="cmdlist-container">
                <div class="layui-card-header layui-elip" style="text-align: center;font-size: 1.4em;" title=" "></div>
                <a href="javascript:;" class="auth_a_image" style="background-color: whitesmoke;"></a><a
                        href="javascript:;"></a>
                <div class="cmdlist-text">
                    <div class="price layui-text-center"
                         style="padding-top: 0.25em;margin-top: 0.25em;border-top: 1px solid #eee;">
                        <div class="layui-row"><a>
                                <div class="layui-col-xs12">
                                    <button class="layui-btn layui-btn-fluid layui-btn-sm layui-btn-primary"
                                            style="border: none;"></button>
                                </div>
                            </a></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg3 auth_div" style="opacity: 0.6;">
            <div class="cmdlist-container">
                <div class="layui-card-header layui-elip" style="text-align: center;font-size: 1.4em;" title=" "></div>
                <a href="javascript:;" class="auth_a_image" style="background-color: whitesmoke;"></a><a
                        href="javascript:;"></a>
                <div class="cmdlist-text">
                    <div class="price layui-text-center"
                         style="padding-top: 0.25em;margin-top: 0.25em;border-top: 1px solid #eee;">
                        <div class="layui-row"><a>
                                <div class="layui-col-xs12">
                                    <button class="layui-btn layui-btn-fluid layui-btn-sm layui-btn-primary"
                                            style="border: none;"></button>
                                </div>
                            </a></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg3 auth_div" style="opacity: 0.6;">
            <div class="cmdlist-container">
                <div class="layui-card-header layui-elip" style="text-align: center;font-size: 1.4em;" title=" "></div>
                <a href="javascript:;" class="auth_a_image" style="background-color: whitesmoke;"></a><a
                        href="javascript:;"></a>
                <div class="cmdlist-text">
                    <div class="price layui-text-center"
                         style="padding-top: 0.25em;margin-top: 0.25em;border-top: 1px solid #eee;">
                        <div class="layui-row"><a>
                                <div class="layui-col-xs12">
                                    <button class="layui-btn layui-btn-fluid layui-btn-sm layui-btn-primary"
                                            style="border: none;"></button>
                                </div>
                            </a></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php
include_once './bottom.php';
?>
<script type="text/javascript">
function listTable(query){
    var url = window.document.location.href.toString();
    var queryString = url.split("?")[1];
    query = query || queryString;
    if(query == 'start' || query == undefined){
        query = '';
        history.replaceState({}, null, './shop.php');
    }else if(query != undefined){
        history.replaceState({}, null, './shop.php?'+query);
    }
    layer.closeAll();
    var ii = layer.msg('正在商品中,请稍后...', {icon: 16, time: 10 * 1000});
    $.ajax({
        type : 'GET',
        url : 'shop-table.php?'+query,
        dataType : 'html',
        cache : false,
        success : function(data) {
            layer.close(ii);
            if (data == '1') {
                layer.msg('没有更多数据', {
                    icon: 2,
                    end: function (layero, index) {
                        listTable();
                    }
                });
            } else {
                $("#content").html(data)
            }
        },
        error:function(data){
            layer.msg('服务器错误', {icon: 5});
            return false;
        }
    });
}
layui.use('util', function () {
    var util = layui.util;
    util.fixbar({
        bar1: true, 
        click: function (type) {
            if (type === 'bar1') {
                layer.alert('是否需要联系站长,若有任何不懂的地方,可以随时联系他哦~<br>客服QQ:<?php echo $admin_qq;?>', {
                    title: '联系客服',
                    icon: '3',
                    btn: ['这就联系Ta', '不用了'],
                    btn1: function (layero, index) {
                        layer.msg('正在跳转聊天窗口!');
                        window.open("http://wpa.qq.com/msgrd?v=3&uin=<?php echo $admin_qq;?>&site=qq&menu=yes", "_blank");
                    }
                });
            }
        }
    });
});
function image_msg(id) {
    $.getJSON('../ajax.php?act=image_shop&id=' + id, function (json) {
        layer.photos({photos: json, anim: 5});
    });
}
function praise(id) { //点赞
    var index = layer.msg('正在为您所喜欢的商品点赞...', {icon: 16, time: 10 * 1000});
    $.ajax({
        type: "post",
        url: "ajax.php?act=praise",
        async: true,
        data: {id: id},
        typeData: 'json',
        success: function (data) {
            if (data.code == 0) {
                layer.close(index);
                $("#praise_" + id).text(data.count);
                layer.msg(data.msg, {icon: 6});
            } else {
                layer.close(index);
                layer.msg(data.msg, {icon: 5});
            }
        }, error: function (data) {
            layer.msg('加载失败!', {icon: 5});
        }
    });
}
function seek() { //搜索内容
    var texts = $("#seek").val();
    if (texts == '') {
        layer.msg('请填写商品名称或介绍的关键词搜索相关商品', {icon: 5});
        return false;
    }
    listTable('type=<?php echo $typessss?>&kw=' + texts);
}
$(document).ready(function(){
    listTable();
})
</script>